<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="PriceTable.aspx.cs" Inherits="Pages_Customer_PriceTable" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="header">Price Table</div><br /><br />
<div>Please Select Service: <asp:DropDownList ID="ddlService" runat="server" autopostback="True" DataSourceID="SqlDataSource1" DataTextField="ServiceName" DataValueField="ServiceID" OnSelectedIndexChanged="ddlService_SelectedIndexChanged">
</asp:DropDownList><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TarsConnection %>"
    SelectCommand="SELECT [ServiceID], [ServiceName] FROM [Services]"></asp:SqlDataSource>
    <br />
    All price is in USD
    <br />
    <br />
</div>
    <table border="1" class="table01">
        <tr>
            <td style="background-color: #a9c0f2; text-align: center">
                <asp:Label ID="Label1" runat="server" CssClass="smallheader"></asp:Label>
            </td>
        </tr>
        <tr>
            <td>
                <asp:GridView ID="gvPrice" runat="server" AutoGenerateColumns="False" DataSourceID="servicePriceDataSource" HeaderStyle-BackColor="#a9c0f2" BorderColor="#556cb0" GridLines="Vertical" Width="560px">
                    <Columns>
                        <asp:BoundField DataField="Weight" HeaderText="Weight" ReadOnly="True" SortExpression="Weight" />
                        <asp:BoundField DataField="In the city" HeaderText="In the city" ReadOnly="True"
                            SortExpression="In the city" />
                        <asp:BoundField DataField="Interprovince under 300km" HeaderText="Interprovince &lt; 300km"
                            ReadOnly="True" SortExpression="Interprovince under 300km" />
                        <asp:BoundField DataField="Interprovince over 300km" HeaderText="Interprovince &gt; 300km"
                            ReadOnly="True" SortExpression="Interprovince over 300km" />
                    </Columns>
                    <HeaderStyle HorizontalAlign="Center" BackColor="#A9C0F2" />
                    <AlternatingRowStyle BackColor="Gainsboro" />
                    <RowStyle HorizontalAlign="Center" />
                </asp:GridView>
                <asp:SqlDataSource ID="servicePriceDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:TarsConnection %>"
                    SelectCommand="SELECT  DISTINCT (SELECT w.WeightID FROM Weight w WHERE w.WeightID=s1.WeightID), &#13;&#10;&#9;&#9;(SELECT w.Description FROM Weight w WHERE w.WeightID=s1.WeightID) AS Weight, &#13;&#10;&#9;&#9;(SELECT Price FROM ServicePrice s2 WHERE s2.WeightID=s1.WeightID AND s2.DistanceID=1 AND s2.ServiceID=@ServiceID) AS [In the city],&#13;&#10;&#9;&#9;(SELECT Price FROM ServicePrice s3 WHERE s3.WeightID=s1.WeightID AND s3.DistanceID=2 AND s3.ServiceID=@ServiceID) AS [Interprovince under 300km],&#13;&#10;&#9;&#9;(SELECT Price FROM ServicePrice s4 WHERE s4.WeightID=s1.WeightID AND s4.DistanceID=3 AND s4.ServiceID=@ServiceID) AS [Interprovince over 300km]&#13;&#10;FROM ServicePrice s1&#13;&#10;WHERE s1.ServiceID=@ServiceID">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="ddlService" Name="ServiceID" PropertyName="SelectedValue" />
                    </SelectParameters>
                </asp:SqlDataSource>
            </td>
        </tr>
    </table>
</asp:Content>

